<!--_meta 作为公共模版分离出去-->
<#include "include/_meta.html">
<!--/meta 作为公共模版分离出去-->

<title>添加管理员 - 管理员管理</title>
<meta name="keywords" content="汽车租赁">
<meta name="description" content="H-ui.admin v2.3，是一款由国人开发的轻量级扁平化网站后台模板，完全免费开源的网站后台管理系统模版，适合中小型CMS后台系统。">
</head>
<body>
<article class="page-container">
	<form class="form form-horizontal" id="form-admin-add" >
	<div class="row cl">
		<label class="form-label col-xs-4 col-sm-3"><span class="c-red">*</span>资源编号：</label>
		<div class="formControls col-xs-8 col-sm-9">
			<input type="text" class="input-text" value="" placeholder="" id="permisid" name="permisid">
		</div>
	</div>
	<div class="row cl">
		<label class="form-label col-xs-4 col-sm-3"><span class="c-red">*</span>中文名称：</label>
		<div class="formControls col-xs-8 col-sm-9">
			<input type="text" class="input-text" value="" placeholder="" id="permisname" name="permisname">
		</div>
	</div>
	<div class="row cl">
		<label class="form-label col-xs-4 col-sm-3"><span class="c-red">*</span>资源代码：</label>
		<div class="formControls col-xs-8 col-sm-9">
			<input type="text" class="input-text" value="" placeholder="" id="permiscode" name="permiscode">
		</div>
	</div>
	<div class="row cl">
		<label class="form-label col-xs-4 col-sm-3"><span class="c-red">*</span>资源类型：</label>
		<div class="formControls col-xs-8 col-sm-9">
			<input type="text" class="input-text" value="" placeholder="" id="permistype" name="permistype">
		</div>
	</div>
	
	
	<div class="row cl">
		<label class="form-label col-xs-4 col-sm-3"><span class="c-red">*</span>相对路径：</label>
		<div class="formControls col-xs-8 col-sm-9">
			<input type="text" class="input-text" value="" placeholder="" id="relateURL" name="relateURL">
		</div>
	</div>
	<div class="row cl">
		<label class="form-label col-xs-4 col-sm-3"><span class="c-red">*</span>上级编号：</label>
		<div class="formControls col-xs-8 col-sm-9">
			<input type="text" class="input-text" value="" placeholder="" name="parentid" id="parentid">
		</div>
	</div>
	<div class="row cl">
		<label class="form-label col-xs-4 col-sm-3"><span class="c-red">*</span>上级目录：</label>
		<div class="formControls col-xs-8 col-sm-9">
			<input type="text" class="input-text" value="" placeholder="" name="parentids" id="parentids">
		</div>
	</div>
	
	<div class="row cl">
		<label class="form-label col-xs-4 col-sm-3"><span class="c-red">*</span>是否启用：</label>
		<div class="formControls col-xs-8 col-sm-9 skin-minimal">
			<div class="radio-box">
				<input name="isabled" type="radio" value="1" id="isabled-1" checked>
				<label for="isabled-1">是</label>
			</div>
			<div class="radio-box">
				<input type="radio" id="isabled-2" value="0" name="isabled">
				<label for="isabled-2">否</label>
			</div>
		</div>
	</div>
	
	
	<div class="row cl">
		<div class="col-xs-8 col-sm-9 col-xs-offset-4 col-sm-offset-3">
			<input class="btn btn-primary radius" type="button" value="&nbsp;&nbsp;提交&nbsp;&nbsp;" onclick="$('#form-admin-add').submit()"/>
		</div>
	</div>
	</form>
</article>

<!--_footer 作为公共模版分离出去--> 
<#include "include/_footer.html">
<!--/_footer /作为公共模版分离出去--> 
<script type="text/javascript" src="lib/webuploader/0.1.5/webuploader.min.js"></script> 

<!--请在下方写此页面业务相关的脚本--> 
<script type="text/javascript">
$(function(){


	var uploader = WebUploader.create({
		auto: true,
		swf: 'lib/webuploader/0.1.5/Uploader.swf',
		server: '/uploadFile',
		pick: '#filePicker',
		fileVal:'uploadfile',
		resize: false,
		accept: {
			title: 'Images',
			extensions: 'gif,jpg,jpeg,bmp,png',
			mimeTypes: 'image/*'
		}
	});


	$('.skin-minimal input').iCheck({
		checkboxClass: 'icheckbox-blue',
		radioClass: 'iradio-blue',
		increaseArea: '20%'
	});
	
	$("#form-admin-add").validate({
		rules:{
			permisname:{
				required:true,
				minlength:4,
				maxlength:16
			},
			permiscode:{
				required:true,
			},
			permistype:{
				required:true,
			},
			
			relateURL:{
				required:true,
			},
			parentid:{
				required:true,
			},
			parentids:{
				required:true,
			},
		},
		onkeyup:false,
		focusCleanup:true,
		success:"valid",
		submitHandler:function(form){
			
	   		$.ajax({
	            type: 'post', 
				contentType:"application/json", 
	            url: '/resource/add', 
	            data:JSON.stringify({
						'permisId': $("#permisid").val(),
		                'permisName': $("#permisname").val(),
		                'permisCode': $("#permiscode").val(),
		                'permisType': $("#permistype").val(),
		                'relateURL': $("#relateURL").val(),
		                'parentId': $("#parentid").val(),
		                'parentids': $("#parentids").val(),
		                'isabled': $(":radio:checked").val()
						}),
	            success:function(data){ 
	 				console.log('提交成功！');
	 				var index = parent.layer.getFrameIndex(window.name);
					parent.location.reload();
					parent.layer.close(index);
	            }
	
	        });

			
		}
	});
});
</script> 
<!--/请在上方写此页面业务相关的脚本-->
</body>
</html>